package com.xxx.ware.ware_manage_sys.bean.enums;

import java.util.HashMap;
import java.util.Map;

public enum OptModuleEnum {
    ADMIN("admin", "管理员中心"),
    USER("user", "用户管理"),
    WAREHOUSE("warehouse","仓库管理"),
    GOOD_CATE("good_cate","物品分类管理"),
    GOODS("goods","仓库物品管理");
    private String key;
    private String text;

    private static Map<String, String> map;

    static {
        map = new HashMap<>();
        for (OptModuleEnum optItem : OptModuleEnum.values()) {
            map.put(optItem.getKey(), optItem.getText());
        }
    }

    private OptModuleEnum(String key, String text){
        this.key = key;
        this.text = text;
    }
    public String getText(){
        return this.text;
    }

    public String getKey() {
        return key;
    }

    public static String getTextByKey(String key){
        return map.getOrDefault(key, "");
    }
}
